package dao.impl;

import dao.TickDao;
import entry.User;
import pojo.TickTable;
import util.DBHelper;

import java.util.ArrayList;

public class TickDaoImpl implements TickDao {
    DBHelper db = new DBHelper();
    @Override
    public ArrayList<User> selectUser(String account, String password) {
        String sql="select * from user where account=? and password=?";
        return db.query(sql, User.class,account,password);

    }

    @Override
    public ArrayList<TickTable> selectTick() {
        String sql = "select v.no,v.amount,e.companyname,i.bankname,v.opentime,v.expirytime,v.uplinkaddress,v.source,v.status\n "+
                "from voucher v \n"+
                "inner join enterprise e on v.enterpriseid=e.id \n"+
                "inner join instituty i on v.institutyid=i.id";

        return db.query(sql, TickTable.class);

    }

    @Override
    public ArrayList<TickTable> selectQueryTicket() {
        String sql = "select v.no,v.amount,e.companyname,i.bankname,v.opentime,v.expirytime,v.uplinkaddress,v.source,v.status\n "+
                "from voucher v \n"+
                "inner join enterprise e on v.enterpriseid=e.id \n"+
                "inner join instituty i on v.institutyid=i.id" ;
        return null;
    }
}
